package me.roger.zen.adapter;

import java.util.ArrayList;

import me.roger.zen.fragment.ZenPhotoFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

public class ZenPhotoAdapter extends FragmentStatePagerAdapter {
	private ArrayList<String> mURLs;
	
	public ZenPhotoAdapter(FragmentManager fm, ArrayList<String> urls) {
		super(fm);
		mURLs = urls;
	}	
	
	@Override
	public Fragment getItem(int position) {
		if (position >= mURLs.size()) {
			return null;
		}
		return ZenPhotoFragment.getInstance(mURLs.get(position));
	}

	@Override
	public int getCount() {
		if (mURLs != null && mURLs.size() > 0) {
			return mURLs.size();
		}
		return 0;
	}

}
